<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户注册</title>



</head>
<body>

	
		<input type="hidden" name="id" value="123"/> <br/>
		用户名:<input type="text" name="username" value="刘"/> <br/>
		
		密码：<input type="password" name="password" value="hao"/> <br/>
		
		<input  id="btn01" type="button" value="登陆">
	
	
	
</body>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.4.js" ></script>
<script type="text/javascript">
$(function(){
	
	$('#btn01').click(function(){
		
		var username=$('input[name="username"]').val();
		var password=$('input[name="password"]').val();
		var id=$('input[name="id"]').val();
		
		var url="${pageContext.request.contextPath}/user";
		
		
		$.ajax({
			'type':'post',
			'url':"${pageContext.request.contextPath}/user.do",
			'data':{
				'username':username,
				'password':password,
				'id':id,
			},
			'success':function(msg){
				console.log(msg);
				if(msg.code==200){
					window.location.href="${pageContext.request.contextPath}/session/success.jsp";
				}else if(msg.code==444){
					window.location.href="${pageContext.request.contextPath}/session/PermissionFilter.jsp";
				}else{
					window.location.href="${pageContext.request.contextPath}/session/error.jsp";
				}
			},
			'dataType':'json'
		});
	
	});
	
});


</script>

</html>